/**
 * Project Name:springBoot-controller
 * File Name:FreamXmlController.java
 * Package Name:com.libra.controller
 * Date:2018年10月31日上午11:31:07
 * Copyright (c) 2018, wangzhch All Rights Reserved.
 *
*/

package com.libra.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSON;
import com.libra.model.vo.ResponseData;
import com.libra.model.xml.TestManyNodeXml;
import com.libra.model.xml.TestOneNodeXml;
import com.libra.model.xml.TestRoundNodeXml;
import com.libra.service.FreamXmlService;

/**
 * ClassName:xml格式数据请求 <br/>
 * Date:     2018年10月31日 上午11:31:07 <br/>
 * @author   wangzhch
 * @version  
 * @since    JDK 1.8
 * @see 	 
 */
@RestController
@RequestMapping("fream")
public class FreamXmlController {
	private Logger log = LoggerFactory.getLogger(FreamXmlController.class);
	
	@Autowired
	private FreamXmlService freamXmlService;
	/**
	 * 
	 * testXml:(1.使用模板组装单个节点的xml报文<单节点>). <br/>
	 * @author wangzhch
	 * @param testXml
	 * @return
	 * @since JDK 1.8
	 */
	@RequestMapping(value="/testOneNodeXml")
	public ResponseData testOneNodeXml(@RequestBody TestOneNodeXml testOneNodeXml) {
		log.info("使用模板组装xml报文:{}",JSON.toJSONString(testOneNodeXml));
		ResponseData data = freamXmlService.testOneNodeXml(testOneNodeXml);
		return data;
	}
	/**
	 * 
	 * testXml:(2.使用模板组装2个以上节点的xml报文<多节点>). <br/>
	 * @author wangzhch
	 * @param testXml
	 * @return
	 * @since JDK 1.8
	 */
	@RequestMapping(value="/testManyNodeXml")
	public ResponseData testManyNodeXml(@RequestBody TestManyNodeXml testManyNodeXml) {
		log.info("2.使用模板组装2个以上节点的xml报文:{}",JSON.toJSONString(testManyNodeXml));
		ResponseData data = freamXmlService.testManyNodeXml(testManyNodeXml);
		return data;
	}
	/**
	 * 
	 * testRoundNodeXml:(3.list节点循环). <br/>
	 * @author wangzhch
	 * @param testRoundNodeXml
	 * @return
	 * @since JDK 1.8
	 */
	@RequestMapping(value="/testRoundNodeXml")
	public ResponseData testRoundNodeXml(@RequestBody TestRoundNodeXml testRoundNodeXml) {
		log.info("3.list节点循环的xml报文:{}",JSON.toJSONString(testRoundNodeXml));
		ResponseData data = freamXmlService.testRoundNodeXml(testRoundNodeXml);
		return data;
	}
}

